<!--
 * @Author       : jiangxiaoying
 * @Date         : 2021-01-15 15:52:02
 * @LastEditors  : jiangxiaoying
 * @LastEditTime : 2021-01-15 17:07:50
 * @FilePath     : \cloud-components\docs\pages\components\cloud-table\example8.vue
-->
<template>
  <div>
    <CloudTable :columns="columns" :data-source="data">
      <a slot="name" slot-scope="text">{{ text }}</a>
    </CloudTable>
  </div>
</template>

<script>
  const columns = [
    {
      title: 'Name',
      dataIndex: 'name',
      key: 'name',
      scopedSlots: { customRender: 'name' },
    },
    {
      title: 'Age',
      dataIndex: 'age',
      key: 'age',
      width: 80,
    },
    {
      title: 'Address',
      dataIndex: 'address',
      key: 'address 1',
      ellipsis: true,
    },
    {
      title: 'Long Column Long Column Long Column',
      dataIndex: 'address',
      key: 'address 2',
      ellipsis: true,
    },
    {
      title: 'Long Column Long Column',
      dataIndex: 'address',
      key: 'address 3',
      ellipsis: true,
    },
    {
      title: 'Long Column',
      dataIndex: 'address',
      key: 'address 4',
      ellipsis: true,
    },
  ];

  const data = [
    {
      key: '1',
      name: 'John Brown',
      age: 32,
      address: 'New York No. 1 Lake Park, New York No. 1 Lake Park',
      tags: ['nice', 'developer'],
    },
    {
      key: '2',
      name: 'Jim Green',
      age: 42,
      address: 'London No. 2 Lake Park, London No. 2 Lake Park',
      tags: ['loser'],
    },
    {
      key: '3',
      name: 'Joe Black',
      age: 32,
      address: 'Sidney No. 1 Lake Park, Sidney No. 1 Lake Park',
      tags: ['cool', 'teacher'],
    },
  ];

  export default {
    title: '8.单元格自动省略 ',
    subTitle: '设置 column.ellipsis 可以让单元格内容根据宽度自动省略。',
    data () {
      return {
        data,
        columns,
      }
    },
    methods: {
    }
  }
</script>

<style lang="scss">
</style>